<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://cdn.staticfile.org/axios/1.4.0/axios.min.js"></script>
</head>

<body>

  <a href="http://oss.xcloud.lenovo.com:8084/cdb-bucket/upload/8b520aab-9466-4001-9f73-59e1321ccaaa.xlsx"
    download="demo.xlsx" name="demo.xlsx">下载</a>
  <!--  -->
  <div onclick="openNewWindow()">open new window</div>

  <!--  -->
  <script>


    const url = "http://oss.xcloud.lenovo.com:8084/cdb-bucket/upload/8b520aab-9466-4001-9f73-59e1321ccaaa.xlsx";
    function openNewWindow() {
      // window.open("http://oss.xcloud.lenovo.com:8084/cdb-bucket/upload/8b520aab-9466-4001-9f73-59e1321ccaaa.xlsx", "_assgin");

      //     fetch(URL, {
      // mode: 'cors',
      // headers: {
      //   'Access-Control-Allow-Origin':'*'
      // }

      fetch(url, { mode: "no-cors" }).then((res) => { return res.blob() }).then((res) => {
        // const resUrl = URL.createObjectURL(new Blob([res]))
        const resUrl = URL.createObjectURL(res)
        const a = document.createElement('a');
        a.href = resUrl;
        a.download = 'file.xlsx';
        a.click();
      })
      // const a = document.createElement('a');
      // a.href = url;
      // a.download = 'file.xlsx';
      // a.click();
    }
    // console.log(axios)
    // axios({ url, responseType: "blob" }).then((res) => {
    //   console.log(res)
    // })

    // channel = new BroadcastChannel("dadadasdad");
    // // channel.onmessage = (e) => {
    // //   console.log("223", e)
    // // }
    // channel.addEventListener("message", (e) => {
    //   console.log("223", e)
    // })
  </script>
</body>

</html>